package com.entity;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;
@Data
public class BaseEntity <T extends Model<?>> extends Model<T> implements Serializable {
    private static final long serialVersionUID = 739668778715426461L;
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    @Column(columnDefinition = "datetime")
    private Date crDate;
    @TableField(update = "now()")
    @ApiModelProperty("修改时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    @Column(columnDefinition = "datetime")
    private Date upDate;
    @Column(columnDefinition = "varchar(10)")
    private String isDel;

    public static final String YES = "yes";
    private static final String NO = "no";
}
